package com.dy.course.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.dy.course.common.BaseController;
import com.dy.course.common.ResponseMessage;
import com.dy.course.entity.RegisterInfo;
import com.dy.course.model.User;
import com.dy.course.service.IUserService;

@Controller
public class RegisterController extends BaseController{

	
	@Autowired
	private IUserService userService;
	
	
	@RequestMapping(value="/user/register")
	@ResponseBody
	public ResponseMessage<?> register(@RequestBody RegisterInfo ri){
		userService.register(ri);
		return constructNullResponse();
	}
	
	@RequestMapping(value="/user/test")
	@ResponseBody
	public ResponseMessage<?> hello(){
		return constructResponse("hello");
	}
	
	@RequestMapping(value="/user/test1")
	@ResponseBody
	public ResponseMessage<User> hello1(){
		User user = new User();
		user.setName("sdfsb");
		user.setPhone("1-322");
		return constructResponse(user);
	}
}
